import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase="DBshop028_新增标签组"
# #打开网页
# firefox=openBrowser(url)
#
# #登录会员
# DBshopLogin(firefox,userName,password)
#





# 登录后台管理系统,地址是"http://localhost/dbshop/admin",
firefox=openBrowser("http://localhost/dbshop/admin")
firefox.get(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
#进入回复评价界面
DBshopEnterMenu3(firefox,"商品管理","商品标签","商品标签分组")
#点击“添加标签组”
firefox.find_element_by_xpath("//a[@class='btn btn-small btn-primary']").click()
#输入标签组名称
firefox.find_element_by_id("tag_group_name").send_keys("华为老大")
#点击“保存标签组信息”
firefox.find_element_by_xpath("(//button[@class='btn btn-small btn-primary'])[2]").click()
#断言
try:
    firefox.find_element_by_xpath("//td[contains(.,'华为老大')]")
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()